<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">

<script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
<link href="//cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet">


	







<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/blog/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT">





  <link rel="alternate" href="/blog/atom.xml" title="WhiteHat" type="application/atom+xml">






<meta name="description" content="TC 从0 编译 这个教程教大家在 64 位 windows 系统下面，怎样从零开始编译一个魔兽世界的服务端（包括 3.3.5 和与官方同步的 7.x 版本），本教程以 7.x 版本为例  图文教学   MaNGOS 芒果端，也就是 M 端，源码地址：https://github.com/mangos/MaNGOS ，MaNGOS 端所有版本 怎样从零开始编译一个魔兽世界服务端 Posted by">
<meta property="og:type" content="article">
<meta property="og:title" content="怎样从零开始编译一个服务端">
<meta property="og:url" content="https://whitehat666.gitee.io/blog/2018/11/18/怎样从零开始编译一个服务端/index.html">
<meta property="og:site_name" content="WhiteHat">
<meta property="og:description" content="TC 从0 编译 这个教程教大家在 64 位 windows 系统下面，怎样从零开始编译一个魔兽世界的服务端（包括 3.3.5 和与官方同步的 7.x 版本），本教程以 7.x 版本为例  图文教学   MaNGOS 芒果端，也就是 M 端，源码地址：https://github.com/mangos/MaNGOS ，MaNGOS 端所有版本 怎样从零开始编译一个魔兽世界服务端 Posted by">
<meta property="og:locale" content="default">
<meta property="og:image" content="https://xianggang-1257694577.cos.ap-hongkong.myqcloud.com/blog/houzi.jpg">
<meta property="og:image" content="https://t1.picb.cc/uploads/2018/11/18/JXXEyi.jpg">
<meta property="og:image" content="https://t1.picb.cc/uploads/2018/11/18/JXXTWd.jpg">
<meta property="og:image" content="https://t1.picb.cc/uploads/2018/11/18/JXXxi1.jpg">
<meta property="og:image" content="https://t1.picb.cc/uploads/2018/11/18/JXB2q8.jpg">
<meta property="og:image" content="https://t1.picb.cc/uploads/2018/11/18/JXXPz0.jpg">
<meta property="og:image" content="https://t1.picb.cc/uploads/2018/11/18/JXX9xa.jpg">
<meta property="og:image" content="https://t1.picb.cc/uploads/2018/11/18/JXXUtu.jpg">
<meta property="og:image" content="https://t1.picb.cc/uploads/2018/11/18/JXXsrD.jpg">
<meta property="og:image" content="https://t1.picb.cc/uploads/2018/11/18/JXXYQW.jpg">
<meta property="og:image" content="https://t1.picb.cc/uploads/2018/11/18/JXBtXy.jpg">
<meta property="og:image" content="https://t1.picb.cc/uploads/2018/11/18/JXBk5G.jpg">
<meta property="og:updated_time" content="2018-11-17T18:36:11.635Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="怎样从零开始编译一个服务端">
<meta name="twitter:description" content="TC 从0 编译 这个教程教大家在 64 位 windows 系统下面，怎样从零开始编译一个魔兽世界的服务端（包括 3.3.5 和与官方同步的 7.x 版本），本教程以 7.x 版本为例  图文教学   MaNGOS 芒果端，也就是 M 端，源码地址：https://github.com/mangos/MaNGOS ，MaNGOS 端所有版本 怎样从零开始编译一个魔兽世界服务端 Posted by">
<meta name="twitter:image" content="https://xianggang-1257694577.cos.ap-hongkong.myqcloud.com/blog/houzi.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://whitehat666.gitee.io/blog/2018/11/18/怎样从零开始编译一个服务端/">




<script>
    (function(){
        if(''){
            if (prompt('请输入文章密码') !== ''){
                alert('密码错误！');
                history.back();
            }
        }
    })();
</script>
  <title>怎样从零开始编译一个服务端 | WhiteHat</title>
  








</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="default">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">WhiteHat</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-首页">
          <a href="https://whitehat666.gitee.io/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-目录">
          <a href="/blog/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br>
            
            目录
          </a>
        </li>
      
        
        <li class="menu-item menu-item-留言板">
          <a href="/blog/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br>
            
            留言板
          </a>
        </li>
      
        
        <li class="menu-item menu-item-添加群聊(联系博主)">
          <a href="https://discord.gg/A5G4KfE" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br>
            
            添加群聊(联系博主)
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://whitehat666.gitee.io/blog/blog/2018/11/18/怎样从零开始编译一个服务端/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Whitehat">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://i.loli.net/2018/11/13/5be9fdb6b566a.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="WhiteHat">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">怎样从零开始编译一个服务端</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-11-18T02:20:09+08:00">
                2018-11-18
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  2.7k
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  10
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="TC-从0-编译"><a href="#TC-从0-编译" class="headerlink" title="TC 从0 编译"></a>TC 从0 编译</h1><p>这个教程教大家在 64 位 windows 系统下面，怎样从零开始编译一个魔兽世界的服务端（包括 3.3.5 和与官方同步的 7.x 版本），本教程以 7.x 版本为例</p>
<h2 id="图文教学"><a href="#图文教学" class="headerlink" title="图文教学"></a>图文教学</h2><p><img src="https://xianggang-1257694577.cos.ap-hongkong.myqcloud.com/blog/houzi.jpg" alt="Alt"></p>
<p>MaNGOS 芒果端，也就是 M 端，源码地址：<a href="https://github.com/mangos/MaNGOS" target="_blank" rel="noopener">https://github.com/mangos/MaNGOS</a> ，MaNGOS 端所有版本<br>怎样从零开始编译一个魔兽世界服务端<br>Posted by xspio on 2018-05-25 16:43:08<br>这个教程教大家在 64 位 windows 系统下面，怎样从零开始编译一个魔兽世界的服务端（包括 3.3.5 和与官方同步的 7.x 版本），本教程以 7.x 版本为例</p>
<p>下图为 7.x 版本进入游戏后的画面（点击图片查看大图）<br><img src="https://t1.picb.cc/uploads/2018/11/18/JXXEyi.jpg" alt="Alt"></p>
<p>MaNGOS 芒果端，也就是 M 端，源码地址：<a href="https://github.com/mangos/MaNGOS" target="_blank" rel="noopener">https://github.com/mangos/MaNGOS</a> ，MaNGOS 端所有版本 MaNGOS 官方都会编译好并在服务端源码的 releases 那里放出下载链接，所以大家都不用编译直接下载就可以使用了</p>
<p>教程里源码使用 TrinityCore，也就是Ｔ端，如果哪天T端也放出编译好的版本，那就不需要这个教程了，在这里告诉下大家，这些服务端源码都是免费的，编译好后也没有任何限制</p>
<p>有兴趣和能力的同学还可以往里面加一些自定义功能，比如传送啊、PlayerBot（也就是我们说的机器人）啊、自定义附魔啊等等（大部分你在外面看到的功能都已经有人写好了，你只要往服务端源码里加入再编译就行了）</p>
<p>其中 3.3.5 版本基本能实现官方 99% 的功能</p>
<p>7.x 版本则很多系统功能和副本脚本都不是很完善，但也是可玩的，特别是对一些喜欢尝新的同学来说</p>
<p>注：教程里使用的是 win10 64 位的系统，所以大部分的截图和环境设置都是以这个为准，如果你使用的是其他版本的系统，比如 win7，其实基本和 win10 是一致的，一样可以照着教程实现正常编译</p>
<p>系统需求：</p>
<p>CPU 处理器必须支持 SSE2 指令集（一般只要不是太旧的 CPU 都支持） </p>
<p>Boost 1.65.1</p>
<p>MySQL ≥ 5.1.0</p>
<p>OpenSSL = 1.0.x </p>
<p>CMake ≥ 3.8.2</p>
<p>MS Visual Studio (Community) ≥ 15 (2017)</p>
<p>Git <a href="https://gitforwindows.org" target="_blank" rel="noopener">https://gitforwindows.org</a> （这个请自行安装）</p>
<p>下面开始上面环境的安装</p>
<p>Boost</p>
<p>下载：<a href="https://dl.bintray.com/boostorg/release/1.65.1/binaries/boost_1_65_1-msvc-14.1-64.exe" target="_blank" rel="noopener">https://dl.bintray.com/boostorg/release/1.65.1/binaries/boost_1_65_1-msvc-14.1-64.exe</a><br><img src="https://t1.picb.cc/uploads/2018/11/18/JXXTWd.jpg" alt=""></p>
<p>如上图安装到默认位置（一般是 C:\local\boost_1_65_1）</p>
<p>然后在系统中添加环境变量，如下图（点击图片看大图）</p>
<p><img src="https://t1.picb.cc/uploads/2018/11/18/JXXxi1.jpg" alt=""><br>MySql</p>
<p>编译用 MySql 下载：<a href="https://dev.mysql.com/downloads/mysql/5.6.html" target="_blank" rel="noopener">https://dev.mysql.com/downloads/mysql/5.6.html</a></p>
<p>下载 Windows (x86, 64-bit), ZIP Archive 这个免安装版本，解压到 D 盘根目录（例 D:\mysql-5.6.40-winx64）</p>
<p>运行用 MySql ，这个用来导入游戏数据库，服务端实际运行在这个数据库下面，编译时不用，后面导入游戏数据库和运行游戏服务端时才用到</p>
<p>这里提供一个绿色免安装的版本，和本站发布的版本里自带那个一样的</p>
<p>链接: <a href="https://pan.baidu.com/s/1XQ_NuCj8Vj8xikyUhlJVDw" target="_blank" rel="noopener">https://pan.baidu.com/s/1XQ_NuCj8Vj8xikyUhlJVDw</a> 密码: vunn</p>
<p>解压到（D:\MySql）后运行里面的 MySQL.bat 就行了，连接数据库用户名和密码如下</p>
<p>用户名：root</p>
<p>密码：ascent</p>
<p>OpenSSL</p>
<p>下载：<a href="http://slproweb.com/products/Win32OpenSSL.html" target="_blank" rel="noopener">http://slproweb.com/products/Win32OpenSSL.html</a></p>
<p>注意：下载 64 位的，版本号为 1.0.x 的版本，不要下载 1.1.x 的版本和名字里带 Light 的版本</p>
<p>比如现在下载的 Win64 OpenSSL v1.0.2o，有可能你下载的时候最后的版本字母 o 会不一样</p>
<p>安装的时候如果系统里没有 Microsoft Visual C++ 2008 Redistributable Package (x64)  会出错</p>
<p>VC ++ 2008 64位下载地址：<a href="https://www.microsoft.com/en-us/download/details.aspx?id=15336" target="_blank" rel="noopener">https://www.microsoft.com/en-us/download/details.aspx?id=15336</a></p>
<p>安装选项里如下图选择，其他的按默认就行了</p>
<p><img src="https://t1.picb.cc/uploads/2018/11/18/JXB2q8.jpg" alt=""></p>
<p>CMake</p>
<p>下载：<a href="https://cmake.org/download/" target="_blank" rel="noopener">https://cmake.org/download/</a></p>
<p>在 Latest Release 下面找到 Windows win64-x64 Installer ，下载这个</p>
<p>安装的时候记得在生成桌面快捷方式上打勾，其他默认，如下图</p>
<p><img src="https://t1.picb.cc/uploads/2018/11/18/JXXPz0.jpg" alt=""></p>
<p>MS Visual Studio (Community)</p>
<p>下载：<a href="https://www.visualstudio.com/zh-hans/" target="_blank" rel="noopener">https://www.visualstudio.com/zh-hans/</a></p>
<p>在下载 windows 版里面选择带 Community 的版本，只有这个是免费的，免费版功能和收费版是一样的</p>
<p>安装的时候注意选项如下图（点击图片放大）</p>
<p>勾选“使用 C ++ 的桌面开发”，如果是 windows 10 的系统，还要勾选右边那两个选项，其他的默认就行了</p>
<p><img src="https://t1.picb.cc/uploads/2018/11/18/JXX9xa.jpg" alt=""></p>
<p>开始编译</p>
<p>到这里我们的编译环境就已经搭建好了，下面需要下载源码了</p>
<p>TrinityCore 下载地址：<a href="https://github.com/TrinityCore/TrinityCore" target="_blank" rel="noopener">https://github.com/TrinityCore/TrinityCore</a></p>
<p>点击 Branches: master 这里可以切换版本分支，版本分支说明在上面源码下载链接的页面上有说，比如现在显示的是 TrinityCore Open Source MMO Framework (master = 7.3.5.26654, 3.3.5 = 3.3.5a.12340) ，说明 master 代表 7.x 版本，3.3.5 代表 3.3.5a.12340 版本（巫妖王之怒），你要编译哪个版本就切换到哪个版本的分支再下载</p>
<p>提醒：如果你编译的是最新 master 分支的版本，一定要先运行 魔兽世界 客户端，检查两个版本号是否对应，不相同就不要编译了，运行不会成功的</p>
<p>客户端版本查看，运行桌面的 魔兽世界 快捷方式，或者在 魔兽世界 文件夹里面运行 World of Warcraft Launcher ，会在上面显示版本信息，我这里显示的版本号也是 7.3.5.26654 ，说明服务端和客户端版本是匹配的，如果不匹配，那你可以更新 魔兽世界 到最新版本，或者等 TrinityCore 更新服务端源码到现在客户端相同版本后才可以编译，否则就不要编译了，编译好了也会因版本不对应而无法进入游戏</p>
<p>这里以 master 分支为例，点击右边的绿色按钮 Clone or download ，点击 Download ZIP 开始下载，下载好后把 TrinityCore-master.zip 解压到 D 盘根目录，重命名 TrinityCore-master 文件夹名称为 Trinity</p>
<p>在 D 盘根目录新建一个命名为 Build 空文件夹，用来放 CMake 生成的源码程序（后面编译好的服务端程序也在这里）</p>
<p>运行安装好的 CMake，刚刚新建了桌面快捷方式的话在桌面就可以直接找到了，没有的话在默认安装目录 C:\Program Files\CMake\bin 运行 cmake-gui.exe</p>
<p><img src="https://t1.picb.cc/uploads/2018/11/18/JXXUtu.jpg" alt=""><br>如上图，点击 Browse Source… 选择源码文件夹 D:\Trinity ，点击 Browse Build… 选择 D:\Build 文件夹，然后点击 Configure<br><img src="https://t1.picb.cc/uploads/2018/11/18/JXXsrD.jpg" alt=""></p>
<p><img src="https://t1.picb.cc/uploads/2018/11/18/JXXYQW.jpg" alt=""></p>
<p>上图“活动解决方案配置”这个选择“RelWithDebInfo”，“活动解决方案平台”选择“x64”，选择好后点击“关闭”</p>
<p>这里 VS 会再次扫描整个方案，等状态栏显示“就绪”后，在 VS 的“解决方案资源管理器”面板里面，右键 ALL_BUILD，选择“生成”</p>
<p>这个过程视每个人的电脑不同，所用时间也不尽相同，我电脑配置差，下去喝杯水先 </p>
<p>片刻后…</p>
<p>项目生成成功，在 VS 的“输出”框内显示如下类似信息</p>
<p>========== 生成: 成功 26 个，失败 0 个，最新 0 个，跳过 0 个 ==========</p>
<p>生成的文件在 D:\Build\bin\RelWithDebInfo 目录里面，至此源码编译就已经完成了</p>
<p>解压 DBC， Maps， VMaps 和 MMaps</p>
<p>在 D:\Build\bin\RelWithDebInfo 文件夹里面，拷贝下面4个文件到 魔兽世界 客户端里面</p>
<p>mapextractor.exe</p>
<p>mmaps_generator.exe</p>
<p>vmap4assembler.exe</p>
<p>vmap4extractor.exe</p>
<p>在 D:\Trinity\contrib 文件夹里面，拷贝 extractor.bat 到 魔兽世界 客户端里面</p>
<p>上面文件全部拷贝完成后，双击拷贝进 魔兽世界 客户端里面的 extractor.bat ，在弹出的对话框中输入数字 4 （解压全部）后敲“回车”键，提示你“This may take a few hours to complete. Please be patient.”意思是全部解压得花好些个小时，你得耐心一点，再次敲“回车”键后开始解压</p>
<p>服务端配置</p>
<p>在 D 盘根目录，新建一个 TrinityCore 的文件夹，把上面生成的 DBC ， Maps ， GT ， VMaps 和 MMaps 这几个文件夹复制或者剪切到这里来</p>
<p>在编译好的 D:\Build\bin\RelWithDebInfo 文件夹里面，把下面的文件拷贝到 D:\TrinityCore 文件夹中</p>
<p>bnetserver.cert.pem</p>
<p>bnetserver.conf.dist</p>
<p>bnetserver.exe</p>
<p>bnetserver.key.pem</p>
<p>bnetserver.pdb</p>
<p>worldserver.conf.dist</p>
<p>worldserver.exe</p>
<p>worldserver.pdb</p>
<p>然后把 bnetserver.conf.dist 和 worldserver.conf.dist 文件名后面的 .dist 删除掉变成 bnetserver.conf 和 worldserver.conf</p>
<p>还有几个文件需要拷贝进来</p>
<p>在 D:\mysql-5.6.40-winx64\lib 文件夹里面，把 libmysql.dll 拷贝到 D:\TrinityCore 文件夹中</p>
<p>在 C:\OpenSSL-Win64 文件夹里面，把 libeay32.dll 和 ssleay32.dll 拷贝到 D:\TrinityCore 文件夹中</p>
<p>下载创建数据库的 sql 文件：<a href="https://github.com/TrinityCore/TrinityCore/blob/master/sql/create/create_mysql.sql" target="_blank" rel="noopener">https://github.com/TrinityCore/TrinityCore/blob/master/sql/create/create_mysql.sql</a> 打开这个页面，在 RAW 这个按钮上面鼠标右键，选择“链接另存为”，把 create_mysql.sql 保存到 D 盘根目录</p>
<p>服务端数据库下载：<a href="https://github.com/TrinityCore/TrinityCore/releases" target="_blank" rel="noopener">https://github.com/TrinityCore/TrinityCore/releases</a></p>
<p>在上面这个下载页面可以看到， TDB 7xx.00 打头的是 7.x 服务端用的数据库， TDB 335.xx 这个是 3.3.5 版本用的数据库，我们编译的是 7.x 的服务端，那就下载 TDB_full_7xxx.7z 这个最新的数据库，下载好后解压到 D 盘根目录</p>
<p>在解压出来的 D:\TDB_full_7xxx 文件夹中，找到“TDB_world_xxx”和“TDB_hotfixes_xxx”两个文件，拷贝到 D:\TrinityCore 目录中去</p>
<p>服务端运行</p>
<p>在 D:\TrinityCore 目录，修改一个文件后，服务端就可以运行了</p>
<p>用编辑器打开 worldserver.conf ，编辑器可以使用 vscode  、 sublime 等等，最好不要用记事本打开</p>
<p>修改 DBC.Locale = 0 ，改成 DBC.Locale = 4 （这个是因为使用的是中文的游戏客户端）</p>
<p>修改 mmap.enablePathFinding = 0 ，改成 mmap.enablePathFinding = 1 （这个可以改善怪物的寻路，免得怪物飞天之类的发生）</p>
<p>修改好后现在运行 D:\TrinityCore 里面的 worldserver.exe ，程序会自动创建、导入并更新数据库，红线标明了正在导入的数据库，如下图（点击图片看大图）<br><img src="https://t1.picb.cc/uploads/2018/11/18/JXBtXy.jpg" alt=""></p>
<p>登录游戏</p>
<p>用编辑器打开你的游戏客户端里面的 WTF\Config.wtf 文件，修改这行 SET portal “CN” 为 SET portal “127.0.0.1”</p>
<p>把 D:\Build\bin\RelWithDebInfo 里面的 connection_patcher.exe 和 刚刚放进 D:\TrinityCore 目录的 libeay32.dll 拷贝到游戏客户端里面，把 Wow-64.exe 拖到 connection_patcher.exe 图标上面放开，会生成 Wow-64_Patched.exe 文件，运行 Wow-64_Patched.exe 这个文件进入游戏，在游戏账号那里输入刚刚创建的 test@test ，密码输入 test 就成功连接了，如果弹出服务器选择框，选择 Trinity 就行了</p>
<p>游戏截图（点击图片看大图）</p>
<p><img src="https://t1.picb.cc/uploads/2018/11/18/JXBk5G.jpg" alt=""></p>

      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="https://i.loli.net/2018/11/13/5be9fa265c642.jpg" alt="Whitehat 微信支付">
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="https://i.loli.net/2018/11/13/5be9fa265c642.jpg" alt="Whitehat 支付宝">
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    
      <div>
        <ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者：</strong>
    Whitehat
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://whitehat666.gitee.io/blog/2018/11/18/怎样从零开始编译一个服务端/" title="怎样从零开始编译一个服务端">https://whitehat666.gitee.io/blog/2018/11/18/怎样从零开始编译一个服务端/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>
    本博客所有文章除特别声明外，均采用 <a href="https://whitehat666.gitee.io/blog/" rel="external nofollow" target="_blank">坚持原创技术分享 转载请注明出处</a> 许可协议。转载请注明出处！
  </li>
</ul>

      </div>
    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2018/11/16/服务端编辑工具/" rel="next" title="服务端编辑工具">
                <i class="fa fa-chevron-left"></i> 服务端编辑工具
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2018/11/18/mangos/" rel="prev" title="大芒果地球端源代码解释">
                大芒果地球端源代码解释 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="lv-container" data-id="city" data-uid="MTAyMC80MDk1NS8xNzQ4MA=="></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="https://i.loli.net/2018/11/13/5be9fdb6b566a.jpeg" alt="Whitehat">
            
              <p class="site-author-name" itemprop="name">Whitehat</p>
              <p class="site-description motion-element" itemprop="description">精心整理 无私奉献</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives">
              
                  <span class="site-state-item-count">15</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            

            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/blog/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#TC-从0-编译"><span class="nav-number">1.</span> <span class="nav-text">TC 从0 编译</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#图文教学"><span class="nav-number">1.1.</span> <span class="nav-text">图文教学</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Whitehat</span>

  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    
      <span class="post-meta-item-text">网站字总数&#58;</span>
    
    <span title="网站字总数">83.7k</span>
  
</div>

<!--
  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>
-->


<span id="timeDate">载入天数...</span><span id="times">载入时分秒...</span>
<script>
    var now = new Date(); 
    function createtime() { 
        var grt= new Date("02/14/2018 12:49:00");//此处修改你的建站时间或者网站上线时间 
        now.setTime(now.getTime()+250); 
        days = (now - grt ) / 1000 / 60 / 60 / 24; dnum = Math.floor(days); 
        hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum); hnum = Math.floor(hours); 
        if(String(hnum).length ==1 ){hnum = "0" + hnum;} minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum); 
        mnum = Math.floor(minutes); if(String(mnum).length ==1 ){mnum = "0" + mnum;} 
        seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum); 
        snum = Math.round(seconds); if(String(snum).length ==1 ){snum = "0" + snum;} 
        document.getElementById("timeDate").innerHTML = "本站已安全运行 "+dnum+" 天 "; 
        document.getElementById("times").innerHTML = hnum + " 小时 " + mnum + " 分 " + snum + " 秒"; 
    } 
setInterval("createtime()",250);
</script>
        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  



  
  









  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/canvas-nest/canvas-nest.min.js"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/three/three.min.js"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/three/three-waves.min.js"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/blog/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  
    <script type="text/javascript">
      (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
      })(document, 'script');
    </script>
  












  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/blog/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  
  

  

  

  

</body>
</html>
